import { BasicColumn, FormSchema } from '@/components/Table';
import { DescItem } from '@/components/Description';

/**
 * 表格列
 */
export const columns: BasicColumn[] = [
  {
    title: '姓名',
    dataIndex: 'name',
    width: 80,
  },
  {
    title: '昵称',
    dataIndex: 'nickname',
    width: 80,
  },

  {
    title: '头像',
    dataIndex: 'avatar',
    width: 80,
  },
  {
    title: '性别',
    dataIndex: 'sex',
    width: 80,
  },

  {
    title: '微信昵称',
    dataIndex: 'wxName',
    width: 80,
  },
  {
    title: '手机号',
    dataIndex: 'phone',
    width: 80,
  },
  {
    title: '生日',
    dataIndex: 'birthday',
    width: 80,
  },
  {
    title: '消费金额',
    dataIndex: 'consumptionAmount',
    width: 80,
  },
  {
    title: '进店次数',
    dataIndex: 'serviceCount',
    width: 80,
  },
  {
    title: '访问次数',
    dataIndex: 'visitCount',
    width: 80,
  },
  {
    title: '创建时间',
    dataIndex: 'createdAt',
    width: 80,
  },
];

/**
 * 查询条件
 */
export const queryFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '姓名',
    component: 'Input',
    componentProps: {},
    colProps: { span: 8 },
  },

  {
    field: 'phone',
    label: '手机号',
    component: 'Input',
    componentProps: {},
    colProps: { span: 8 },
  },
];

/**
 * 查看详情表单
 */
export const retrieveDetailFormSchema: DescItem[] = [
  {
    field: 'name',
    label: '姓名',
  },
  {
    field: 'nickname',
    label: '昵称',
  },
  {
    field: 'password',
    label: '密码，建议加密存储',
  },
  {
    field: 'avatar',
    label: '头像URL',
  },
  {
    field: 'sex',
    label: '性别,1，男，2，女',
  },
  {
    field: 'wxUnionid',
    label: '微信唯一标识',
  },
  {
    field: 'wxName',
    label: '微信昵称',
  },
  {
    field: 'phone',
    label: '手机号',
  },
  {
    field: 'birthday',
    label: '生日',
  },
  {
    field: 'consumptionAmount',
    label: '消费金额',
  },
  {
    field: 'serviceCount',
    label: '进店次数',
  },
  {
    field: 'visitCount',
    label: '访问次数',
  },
  {
    field: 'createdAt',
    label: '创建时间',
  },
  {
    field: 'updatedAt',
    label: '更新时间',
  },
];

/**
 * 新增/编辑表单
 */
export const insertOrUpdateFormSchema: FormSchema[] = [
  {
    field: 'id',
    // 只是为了把ID带过来
    label: '主键ID',
    component: 'Render',
    ifShow: false,
  },
  {
    field: 'name',
    label: '姓名',
    required: true,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'nickname',
    label: '昵称',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'password',
    label: '密码，建议加密存储',
    required: true,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'avatar',
    label: '头像URL',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'sex',
    label: '性别,1，男，2，女',
    required: true,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'wxUnionid',
    label: '微信唯一标识',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'wxName',
    label: '微信昵称',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'phone',
    label: '手机号',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'birthday',
    label: '生日',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'consumptionAmount',
    label: '消费金额',
    required: false,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'serviceCount',
    label: '进店次数',
    required: true,
    component: 'Input',
    componentProps: {},
  },
  {
    field: 'visitCount',
    label: '访问次数',
    required: true,
    component: 'Input',
    componentProps: {},
  },
];
